def logging(flag):
    def decorator(fn):
        def inner(a, b):
            if flag == "+":
                print("正在执行加法计算")
            elif flag == "-":
                print("正在执行减法计算")
            return fn(a, b)

        return inner

    return decorator


@logging("+") #  1. logging("+") => decorator 2. @decorator 3. add = decorator(add)
def add(a, b):
    result = a + b
    return result


@logging("-")
def sub(a, b):
    result = a - b
    return result

result = add(1, 2)
print(result)

result = sub(1, 3)
print(result)